<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	
	<div class="container-div">
		<div class="row">
	       <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
	            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:project:add">
	                <i class="fa fa-plus"></i> 新增
	            </a>
	        </div>
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script th:inline="javascript">
		var listFlag = [[${@permission.hasPermi('system:project:bindUser')}]];
		var editFlag = [[${@permission.hasPermi('system:project:editUser')}]];
		var removeFlag = [[${@permission.hasPermi('system:project:deleteUser')}]];
		var prefix = ctx + "system/project";
        var projectId = [[${projectId}]];
		$(function() {
		    var options = {
		        url: prefix + "/bindUserList",
		        createUrl: prefix + "/addUser/"+projectId,
		        updateUrl:prefix + "/editUser/{id}",
		        removeUrl: prefix + "/deleteUser/{id}",
		        queryParams: queryParams,
		        search: false,
		        showExport: false,
		        modalName: "项目成员",
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'userName',
		            title: '成员名称'
		        },
		        {   
		        	field: 'roleName',
		            title: '担任角色',
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.projectId +'@'+ row.userId +'\')"><i class="fa fa-edit"></i>编辑</a> ');
		                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.projectId +'@'+ row.userId+  '\')"><i class="fa fa-remove"></i>删除</a>');
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		});
		
		function queryParams(params) {
			return {
				projectId :projectId
			};
		}
	</script>
</body>
</html>